<?php

class M_PstGrad extends CI_Model {

    function __construct() {
        // Call the Model constructor
        parent::__construct();
        $this->_tabela = 'PST_GRAD';
    }

    public function listaPstGrad($arrayCol = null, $where = null, $limit = null, $offset = null, $orderby = null) {
        return $this->select($arrayCol, $where, $limit, $offset, $orderby);
    }

    public function cmbPstGrad($pstGradId = null) {
        /*
         * Buscando a lista de pst grad no banco
         */
        $resultPstGrad = $this->listaPstGrad()->result();

        /*
         * Inicializando var $comboPstGrad
         */
        $comboPstGrad = null;

        /*
         * Montando a combo para view
         */
        foreach ($resultPstGrad as $value) {
            $selected = ($value->ID == $pstGradId) ? "selected='selected'" : '';
            $comboPstGrad .= "<option $selected value='$value->ID'>$value->PST_GRAD_DESC</option>";
        }
        return $comboPstGrad;
    }

}

?>